#ifndef __WORLD_ITEM_HPP__
#define __WORLD_ITEM_HPP__

#include "Engine/Vector3.hpp"
#include "Engine/Matrix.h"
#include "Engine/Color4.hpp"
#include <cstdint>
#include <memory>
#include "GameEnum.h"
#include "entt/entity/entity.hpp"

using namespace PocketSurvival::Engine;

namespace PocketSurvival
{

    struct ComponentCreature;

    enum class WorldItemType
    {
        Pickable,
        Projectile
    };

    struct WorldItem
    {
        int32_t value;
        Vector3 position;
        Vector3 velocity;
        double creationTime;
        WorldItemType type;
        bool toRemove = false;
    };

    struct Pickable : public WorldItem
    {
        uint32_t count;
        std::shared_ptr<Vector3> flyToPosition = nullptr;
        std::shared_ptr<Matrix> stuckMatrix = nullptr;
        // bool splashGenerated = true;                             // 飞溅生成
        uint16_t id;
        // bool playSound = false;                                  // 播放音乐

        inline Pickable()
        {
            type = WorldItemType::Pickable;
        }
    };

    struct Projectile : public WorldItem
    {
        Vector3 rotation;
        Vector3 angularVelocity;
        bool isInWater;
        entt::entity ownerEntity = entt::null;
        ProjectileStoppedAction projectileStoppedAction;
        // 不在存在的区块内
        bool noChunk;
        // 是否燃烧状态
        bool isIncendiary;
        bool isFireProjectile;

        inline Projectile()
        {
            type = WorldItemType::Projectile;
        }
    };

} // namespace PocketSurvival

#endif
